<?php use_helper('I18N') ?>

<?php echo form_tag('structure/third', array('id' => 'frmlogin', 'name' => 'frmlogin')) ?>

<table width="950">
	<tr>
    	<td valign="top">
        	<table width="100%">
            	<tr>
                	<td align="left" class="welcome">WELCOME <?php echo $_SESSION['user_name']; ?></td>
                    <td width="16">&nbsp;</td>
                    <td width="164"></td>
                    <td width="70" align="right" valign="bottom"><img name="btnLogout" id="btnLogout" onmouseover="roll_over('btnLogout', '/images/logout_btnAF.jpg')" onmouseout="roll_over('btnLogout', '/images/logout_btn.jpg')" src="/images/logout_btn.jpg" border="0" onClick="location.href='/user/logout'" /></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
    	<td align="right"><a href='/structure/thirdedit?height=220&width=440' rel='sexylightbox'><img name="btnNew" id="btnNew" onmouseover="roll_over('btnNew', '/images/create_new_user_btnAF.jpg')" onmouseout="roll_over('btnNew', '/images/create_new_user_btn.jpg')" src="/images/create_new_user_btn.jpg" border="0" /></a></td>
    </tr>
    <tr>
    	<td><div id="pm_ex_list" name="pm_ex_list">
        	<table class="admin" width="100%" cellpadding="0" cellspacing="0">
            	<tr>
                	<td align="left" class="adminTitle" height="40">&nbsp;Structure 3</td>
                </tr>
                <?php
					echo '<tr><td class="adminTitle">';
					echo '<table width="100%"><tr>';
                    echo '<td width="150" align="left">Level 1</td>';
                    echo '<td width="150" align="left">Level 2</td>';
                    echo '<td width="150" align="left">Level 3</td>';
                    echo '<td width="400" align="left">Favorite Link</td>';
                    echo '<td width="85" align="left">Sequence</td>';
                    echo '<td width="66" align="left" valign="middle"></td>';
                    echo '<td width="66" align="left" valign="middle"></td>';
                    echo '</tr></table>';
                    echo '</td></tr>';
					
					$color = "#cfecdb";
					foreach ($tbl_structures as $tbl_structure){
						$c = new Criteria();
						$c->add(TblStructurePeer::F_PARENTID, $tbl_structure->getFId());
						$c->addAscendingOrderByColumn(TblStructurePeer::F_SEQ_NO);
						$rs_second = TblStructurePeer::doSelect($c);
						
						foreach($rs_second as $second){
							$c = new Criteria();
							$c->add(TblStructurePeer::F_PARENTID, $second->getFId());
							$c->addAscendingOrderByColumn(TblStructurePeer::F_SEQ_NO);
							$rs_third = TblStructurePeer::doSelect($c);
							
							foreach($rs_third as $third){
								//$second = TblStructurePeer::retrieveByPk($tbl_structure->getFParentid());
								//$first = TblStructurePeer::retrieveByPk($second->getFParentid());
								
								echo '<tr><td bgcolor="'.$color.'">';
								echo '<table width="100%"><tr>';
								echo '<td width="150" align="left">'.$tbl_structure->getFName().'</td>';
								echo '<td width="150" align="left">'.$second->getFName().'</td>';
		                        echo '<td width="150" align="left">'.$third->getFName().'</td>';
		                        echo '<td width="400" align="left">'.$third->getFLink().'</td>';
		                        echo '<td width="85" align="left">'.$third->getFSeqNo().'</td>';
		                        echo '<td width="66" align="left" valign="middle"><img src="/images/icon_edit.png" />&nbsp;<a href="/structure/thirdedit?f_id='.$third->getFId().'&height=220&width=440" rel="sexylightbox" class="login">edit</a></td>';
		                        echo '<td width="66" align="left" valign="middle"><img src="/images/icon_close.png" />&nbsp;'.link_to('delete','structure/delete?f_structure=3&f_id='.$third->getFId(), array('class'=>'login', 'post'=>'true', 'confirm'=>'Are you sure you want to delete?')).'</td>';
		                      	echo '</tr></table>';
		                       	echo '</td></tr>';
		                            	
		                      	if($color=="#cfecdb")
		                      		$color="#ffffff";
		                       	else
		                       		$color = "#cfecdb";
							}								
						}				
						
					}
				?>
            </table>
            </div>
        </td>
    </tr>    
    <tr>
    	<td height="20" align="center"><img name="btnBack" id="btnBack" onmouseover="roll_over('btnBack', '/images/back_btnAF.jpg')" onmouseout="roll_over('btnBack', '/images/back_btn.jpg')" src="/images/back_btn.jpg" border="0" onClick="location.href='/user/main'" /></td>
    </tr>
</table>

</form>
